#pragma once

#include <cstddef>
#include <initializer_list>
#include <iostream>
#include <memory>
#include <stdexcept>
#include <fmt/format.h>
#include <istream>
#include <ostream>

class MyArray final
{
    friend std::istream &operator>>(std::istream &in, MyArray &a);

    friend void swap(MyArray &a, MyArray &b) noexcept;

public:
    explicit MyArray(size_t size);
    explicit MyArray(std::initializer_list<int> list);
    ~MyArray();
    MyArray(const MyArray &) noexcept;
    MyArray(MyArray &&) noexcept;
    MyArray &operator=(const MyArray &) noexcept;
    MyArray &operator=(MyArray &&) noexcept;

    size_t size() const noexcept;
    std::string toString() const;
    bool operator==(const MyArray &) const noexcept;
    int &operator[](size_t index);
    const int &operator[](size_t index) const;
    explicit operator bool() const noexcept;
    MyArray &operator++();
    MyArray operator++(int);
    MyArray &operator+=(int);

private:
    size_t m_size{ 0 };
    std::unique_ptr<int[]> m_ptr;
};
std::ostream &operator<<(const std::ostream &out, MyArray &a);
